home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 April
/
EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso
/
EARCD
/
comm
/
mail
/
YAMscripts.lha
/
CheckNewMail.rexx
next >
Wrap
OS/2 REXX Batch file
|
1996-11-19
|
4KB
|
131 lines
/* CheckNewMail.rexx
v 1.2 - 19-Nov-96
This script checks if there are new or unread messages and where they are.
It requiress reqtools and rexxreqtools libraries.
Changes in 1.2
- Output is slightly different
- Message counts should now always fit, even with long foldernames
Changes in 1.1
- Displays number of new/unread messages in each folder
- All messages are now in variables and easy to change
You can always get the latest version of this script by send a message
with subject REQUEST CheckNewMail.rexx to knikulai@utu.fi. If you send
a message with subject REQUEST INDEX, you'll get a listing of all my
publicly available AREXX scripts.
*/
options results
maxfolder=9 /* Set this to the number of folders you have-1*/
cols=3 /* How many colums of folders in requester */
wid=17 /* Max displayed width of foldername + message counts*/
butl=70 /* Maximum length of buttons in characters. Increase this a bit
if you are using a proportional font. */
sunr='YES' /* Search for unread messages too ( yes/no ) */
/* Change these to something you like */
title='CheckNewMail.rexx'
new_title='You have new mail in following folders: (new/unread)'
no_new_title='You have no new mail.'
unread_title='You have unread mail in following folders:'
no_unread_title='You have no folders with only unread mail.'
select_folder='Select folder you want to read next'
last_button='_Done'
addlib('rexxreqtools.library',0,-30)
address 'YAM'
GetFolderInfo Number /* Let's remember where we are now */
orig_fold=result
GetMailInfo Active
orig_msg=result
nc=0 /* new-counter */
uc=0 /* unread-counter */
NL='0a'x /* newline */
do f=0 to maxfolder
if f~=1 & f~=2 then do /* Don't check Outgoing nor Sent */
SetFolder f
GetFolderInfo Name
fn=result /* Name of the folder */
GetFolderInfo Max
n=result /* Number of messages in the folder */
i=0
nm=0
um=0
do while i<n
SetMail i
i=i+1
GetMailInfo Status
if result='N' then nm=nm+1 /* New message was found */
if result='U' & upper(sunr)='YES' then um=um+1/* Unread message was found */
end /* do while i<n */
if nm>0 then do /* New messages were found */
nc=nc+1
foo= nm ||'/'|| um
new.nc=left(fn||' ',wid-length(foo), '.') || foo
newn.nc=f
end
else
if um>0 & upper(sunr)='YES' then do /* New messages were found */
uc=uc+1
unread.uc=left(fn||' ', wid-length(um), '.') || um
unreadn.uc=f
end
end /* if f~=1 & f`=2 then do */
end /* do f=0 to maxfolder */
/* Now all folders have been scanned */
but=''
bc=0
/* Return to where we were before starting this script */
'SetFolder' orig_fold
'SetMail' orig_msg
/* Let's first list new messages */
if nc>0 then
rt=new_title
else
rt=no_new_title || NL
rt=rt || NL
do i=1 to nc
rt=rt || new.i || ' '
if length(but)+length(word(new.i,1))<butl then do
but=but || word(new.i,1) || '|'
bc=bc+1
butn.bc=newn.i
end
if i//cols = 0 then rt=rt || NL
end
/* Then it's time to list unread messages, if that was asked */
if upper(sunr)='YES' then do
if uc>0 then
rt=rt||NL|| unread_title
else
rt=rt||NL|| no_unread_title
rt=rt || NL
do i=1 to uc
rt=rt || unread.i ||' '
if i//cols = 0 then rt=rt || NL
if length(but)+length(word(unread.i,1))<butl then do
but=but || word(unread.i,1) || '|'
bc=bc+1
butn.bc=unreadn.i
end
end
end /* if upper(sunr)='YES' */
rt=rt || NL || NL || select_folder
but=but || last_button
tags='rtez_defaultresponse=0'
sel=rtezrequest(rt,but,title,tags)
if sel>0 then address 'YAM' 'SetFolder ' || butn.sel